<header id="topbar">
    <div class="topbar-left">
        <ol class="breadcrumb">
            <li class="crumb-active">
                <a href="#op/add_recharge_order">充值补单管理</a>
            </li>
        </ol>
    </div>

    <div class="topbar-right">
        <div class="btn btn-default btn-sm light fw600 ml10" id="addNewItem"><span class="fa fa-plus pr5"></span>新增订单
        </div>
        <div class="ml15 ib va-m" id="toggle_sidemenu_r">
            <a href="#" class="pl5"> <i class="fa fa-sign-in fs22 text-primary"></i>
            </a>
        </div>
    </div>
</header>

<section id="content" class="animated fadeIn">
    <div class="panel overflow" >
        <table class="table table-striped fs13" id="main-list">
            <thead>
            <tr class="bg-light">
                <th>ID</th>
                <th>支付状态</th>
                <th>下单时间</th>
                <th>更新（到账）时间</th>
                <th>用户ID</th>
                <th>充值类型</th>
                <th>充值金额</th>
            </tr>
            </thead>
            <tbody class="admin-form">
            <% _.each(items, function(item){
               <!--var channel_id = item.extend.channel_id;-->
               <!--var admin_id = item.extend.admin_id;-->
            %>
            <tr data-id="<%= item.id %>" >
                <th><%= item.id %></th>
                <td><%= item.status %></td>
                <td><%= item.created_at %></td>
                <td><%= item.updated_at %></td>
                <td><%= item.user_id %></td>
                <td><%= item.pay_type %></td>
                <td><%= item.price %></td>
            </tr>
            <%
            }) %>
            </tbody>
        </table>
    </div>

    <div><div class="pull-left" id="page-tips"></div><div id="paginator"></div></div>
</section>


<div id="addNewItemPanel" class="popup-basic popup-lg bg-none mfp-with-anim mfp-hide">
    <div class="panel">
        <div class="panel-heading">
            <span class="panel-icon"><i class="fa fa-pencil"></i></span>
            <span class="panel-title">新增订单</span>
        </div>
        <div class="panel-body">

            <form class="form-horizontal ml15" id="content-form" role="form">
                <div class="form-group">
                    <label class="col-md-3 control-label">用户ID:</label>
                    <div class="col-md-6">
                        <input type="number" id="inputUid" class="form-control" value="<%= searched.user_id  %>" data-field="user_id" required>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-3 control-label">充值类型:</label>
                    <div class="col-md-6">
                        <select class="form-control" id="inputRechargeType" data-field="recharge_type" data-type="int">
                            <% _.each(PAY_TYPE, function(v, k){ %>
                            <%   if(k >=1000 && k <=1013){ %>
                            <option value="<%= k %>" selected ><%= v %></option>
                            <% }}) %>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-3 control-label">通道ID：</label>
                    <div class="col-md-6">
                        <input type="text" id="channel_id" class="form-control" value="<%= searched.channel_id  %>" data-field="channel_id" required>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-md-3 control-label">充值金额：</label>
                    <div class="col-md-6">
                        <input type="number" id="pay_amount" class="form-control" value="<%= searched.pay_amount  %>" data-field="pay_amount" required>
                    </div>
                </div>

            </form>
        </div>
        <div class="panel-footer text-right">
            <button class="btn btn-default" type="button" id="cancelAddNewItem">取消</button>
            <button class="btn btn-primary" type="button" id="confirmAddNewItem">确定</button>
        </div>
    </div>
</div>


<aside id="sidebar_right" class="nano">
    <div class="sidebar_right_content nano-content">
        <div class="tab-block sidebar-block br-n">
            <ul class="nav nav-tabs tabs-border nav-justified">
                <li class="active">
                    <a href="#sidebar-right-tab1" data-toggle="tab">统计数据</a>
                </li>
                <li>
                    <a href="#sidebar-right-tab2" data-toggle="tab">过滤搜索</a>
                </li>
            </ul>
            <div class="tab-content br-n">
                <div id="sidebar-right-tab1" class="tab-pane active">
                    <div class="p20 admin-form">
                        <% var total = 0,
                        count = 0;
                        _.each(overview, function(obj){
                        total += obj.total;
                        count += obj.count;
                        %>
                        <h5 class="title-divider text-muted mb20"><%= PAY_TYPE[obj.pay_type] %><span class="pull-right"> <%= obj.total %>/<%= obj.count %>次 </span> </h5>
                        <%})
                        if(overview.length > 1){%>
                        <h5 class="title-divider text-muted mb20">总计<span class="pull-right"> <%= total.toFixed(2) %>/<%= count %>次 </span> </h5>
                        <% }else if(overview.length == 0){ %>
                        <h5 class="text-muted mb20">无数据...</h5>
                        <% } %>
                    </div>
                </div>
                <div id="sidebar-right-tab2" class="tab-pane">
                    <div class="p20 admin-form">
                        <h6 class="fw400">支付状态</h6>
                        <div class="section mb15">
                            <label class="field select">
                                <select id="searchStatus" name="searchStatus" data-field="status">
                                    <option value="2" <%= searched.status == 2 ? 'selected' : '' %>>已支付</option>
                                    <option value="1" <%= searched.status == 1 ? 'selected' : '' %>>未支付</option>
                                    <option value="4" <%= searched.status == 4 ? 'selected' : '' %>>支付失败</option>
                                    <option value="0" <%= searched.status == 0 ? 'selected' : '' %>>全部</option>
                                </select>
                                <i class="arrow double"></i>
                            </label>
                        </div>
                        <div class="section mb15">
                            <label for="searchId" class="field prepend-icon">
                                <input title="ID" type="text" data-field="user_id" id="searchId" class="gui-input" placeholder="ID" value="<%= searched.id  %>">
                                <label for="searchId" class="field-icon"><i class="fa fa-tag"></i>
                                </label>
                            </label>
                        </div>
                        <div class="section mb15">
                            <label for="searchUserId" class="field prepend-icon">
                                <input title="用户ID" type="text" data-field="user_id" id="searchUserId" class="gui-input" placeholder="用户ID" value="<%= searched.user_id  %>">
                                <label for="searchUserId" class="field-icon"><i class="fa fa-tag"></i>
                                </label>
                            </label>
                        </div>
                        <h6 class="fw400">充值时间</h6>
                        <div class="section row">
                            <div class="col-md-6">
                                <input type="text" title="下限，包含当天" name="searchCreatedAtLower" id="searchCreatedAtLower" class="gui-input" data-type="date" value="<%= searched.created_at_lower %>" placeholder=">=">
                                </label>
                                </label>
                            </div>
                            <div class="col-md-6">
                                <input type="text" title="上限，不包括当天" name="searchCreatedAtUpper" id="searchCreatedAtUpper" class="gui-input" data-type="date" value="<%= searched.created_at_upper %>" placeholder="<">
                                </label>
                                </label>
                            </div>
                        </div>
                        <h6 class="fw400">充值方式</h6>
                        <div class="section mb15">
                            <label class="field select">
                                <select id="searchPayType" name="searchPayType" data-field="pay_type">
                                    <option value="-1" <%= searched.pay_type == -1 ? 'selected' : '' %>>所有</option>
                                    <% _.each(PAY_TYPE, function(v, k){%>
                                    <option value="<%= k %>" searched.pay_type == k ? 'selected': 0><%= v %></option>
                                    <% }) %>
                                </select>
                                <i class="arrow double"></i>
                            </label>
                        </div>
                        <h6 class="fw400">用户类型</h6>
                        <div class="section mb15">
                            <label class="field select">
                                <select id="searchUserType" name="searchUserType" data-field="user_type">
                                    <option value="-1" <%= searched.user_type == -1 ? 'selected' : '' %>>所有</option>
                                    <% _.each(USER_TYPE, function(v, k){%>
                                    <option value="<%= k %>" searched.user_type == k ? 'selected': 0><%= v %></option>
                                    <% }) %>
                                </select>
                                <i class="arrow double"></i>
                            </label>
                        </div>
                        <hr class="short">

                        <button class="btn btn-default btn-block" type="button" id="search">搜索</button>

                    </div>
                </div>
            </div>
        </div>
    </div>

</aside>
